﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geodatabase;
using Akiha.Core;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.DataSourcesGDB;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.esriSystem;


namespace ArcMap_AddIn_Tools.Dialog.Controls
{
    //继承ComboBox的应用于AO
    //用于显示图层的单个要素
    class ComboBoxExtensionForAO:ComboBox
    {
        ////一般传入这两类参数
        //private IFeatureClass m_pFeaCls = null;

        //private List<IFeature> m_lstpFeas = null;


        private BindingSource m_BindingSource = new BindingSource();

        public ComboBoxExtensionForAO()
        {

        }

        //载入字段到其中
        public void LoadFeatures(IFeatureClass pFeaCls,string strDisplay)
        {
            List<IFeature> lstpFeas = FeatureClassWrapper.GetFeaturesFromFeatureClass(pFeaCls, null);
            LoadFeatures(lstpFeas,strDisplay);
        }

        //重载的载入字段
        public void LoadFeatures(List<IFeature> lstpFea,string strDisplay)
        {
            List<IRow> lstRows = lstpFea.ConvertAll<IRow>(p=>p);
            m_BindingSource.DataSource = new TableWrapper(lstRows);
            this.DataSource = m_BindingSource;
            this.DisplayMember = strDisplay;
        }

    }
}
